package Vistas;

import javax.swing.*;

import java.awt.*;

import Controlador.CCliente;

public class VCliente extends JFrame{
	
        private static final long serialVersionUID = 1L;
		private JLabel lblCedCli,lblNomCli,lblApeCli,lblTelCli,lblDirCli,lblTitulo;
		private JTextField txtCedCli,txtNomCli,txtApeCli,txtTelCli,txtDirCli;
		private JButton btnBusCli,btnAgrCli,btnModCli,btnCanCli,btnSalCli;
		private JPanel panelNorte,panelSur,p1;
		public VCliente(){
		
			setTitle("***Clientes***");
			lblTitulo= new JLabel ("***Registrar Cliente***");
			lblCedCli = new JLabel ("Cedula:     ");
			txtCedCli = new JTextField(10);
			btnBusCli = new JButton("  Buscar  ");
			lblNomCli = new JLabel("Nombre:   ");
			txtNomCli = new JTextField(10);
			lblApeCli = new JLabel("Apellido:   ");
			txtApeCli = new JTextField(10);
			lblTelCli = new JLabel("Telefono:  ");
			txtTelCli = new JTextField(10);
			lblDirCli = new JLabel("Direccion:");
			txtDirCli = new JTextField(10);
			btnAgrCli = new JButton(" Agregar ");
			btnModCli = new JButton("Modificar");
			btnCanCli = new JButton("Cancelar ");
		    btnSalCli = new JButton("    Salir     ");
			
			panelNorte = new JPanel(new GridLayout(7,1));
			
			p1=new JPanel(new FlowLayout(FlowLayout.CENTER));
			p1.add(lblTitulo);
			panelNorte.add(p1);
			
			p1=new JPanel(new FlowLayout(FlowLayout.LEFT));
			p1.add(lblCedCli);
			p1.add(txtCedCli);
			p1.add(btnBusCli);
			panelNorte.add(p1);
			
			p1=new JPanel(new FlowLayout(FlowLayout.LEFT));
			p1.add(lblNomCli);
			p1.add(txtNomCli);
	        panelNorte.add(p1);
	        
	        p1=new JPanel(new FlowLayout(FlowLayout.LEFT));
			p1.add(lblApeCli);
			p1.add(txtApeCli);
	        panelNorte.add(p1);
	        
	        p1=new JPanel(new FlowLayout(FlowLayout.LEFT));
			p1.add(lblTelCli);
			p1.add(txtTelCli);
	        panelNorte.add(p1);
	        
	        p1=new JPanel(new FlowLayout(FlowLayout.LEFT));
			p1.add(lblDirCli);
			p1.add(txtDirCli);
	        panelNorte.add(p1);
	        
	        panelSur = new JPanel();
	        
	        panelSur.add(btnAgrCli);
	        panelSur.add(btnModCli);
	        panelSur.add(btnCanCli);
	        panelSur.add(btnSalCli);
	        panelNorte.add(panelSur);
	        add(panelNorte, BorderLayout.NORTH);
	        //add(panelSur, BorderLayout.SOUTH);
	        iniciar();
	   	    CCliente controladorCliente = new CCliente(this);
	        
	        btnBusCli.addActionListener(controladorCliente);
	        btnAgrCli.addActionListener(controladorCliente);
	        btnModCli.addActionListener(controladorCliente);
	        btnCanCli.addActionListener(controladorCliente);
	        btnSalCli.addActionListener(controladorCliente);
	        
	        setSize(400,300);
	        setVisible(true);
	        
		}
		
        public JTextField getTxtCedCli() {
			return txtCedCli;
		}

		public void setTxtCedCli(JTextField txtCedCli) {
			this.txtCedCli = txtCedCli;
		}

		public JTextField getTxtNomCli() {
			return txtNomCli;
		}

		public void setTxtNomCli(JTextField txtNomCli) {
			this.txtNomCli = txtNomCli;
		}

		public JTextField getTxtApeCli() {
			return txtApeCli;
		}

		public void setTxtApeCli(JTextField txtApeCli) {
			this.txtApeCli = txtApeCli;
		}

		public JTextField getTxtTelCli() {
			return txtTelCli;
		}

		public void setTxtTelCli(JTextField txtTelCli) {
			this.txtTelCli = txtTelCli;
		}

		public JTextField getTxtDirCli() {
			return txtDirCli;
		}

		public void setTxtDirCli(JTextField txtDirCli) {
			this.txtDirCli = txtDirCli;
		}

		public JButton getBtnBusCli() {
			return btnBusCli;
		}

		public void setBtnBusCli(JButton btnBusCli) {
			this.btnBusCli = btnBusCli;
		}

		public JButton getBtnAgrCli() {
			return btnAgrCli;
		}

		public void setBtnAgrCli(JButton btnAgrCli) {
			this.btnAgrCli = btnAgrCli;
		}

		public JButton getBtnModCli() {
			return btnModCli;
		}

		public void setBtnModCli(JButton btnModCli) {
			this.btnModCli = btnModCli;
		}

		public JButton getBtnCanCli() {
			return btnCanCli;
		}

		public void setBtnCanCli(JButton btnCanCli) {
			this.btnCanCli = btnCanCli;
		}

		public JButton getBtnSalCli() {
			return btnSalCli;
		}

		public void setBtnSalCli(JButton btnSalCli) {
			this.btnSalCli = btnSalCli;
		}
		public void iniciar(){
		getBtnAgrCli().setEnabled(false);
		getBtnModCli().setEnabled(false);
		getBtnCanCli().setEnabled(false);
		getTxtApeCli().setText("");
		getTxtApeCli().setEditable(false);
		getTxtNomCli().setText("");
		getTxtNomCli().setEditable(false);
		getTxtDirCli().setText("");
		getTxtDirCli().setEditable(false);
		getTxtTelCli().setText("");
		getTxtTelCli().setEditable(false);
		getTxtCedCli().setText("");
		getTxtCedCli().requestFocus();
			
		}


		
}
